<!DOCTYPE html>
<html lang="zh" class="h-100">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>故障诊断 - 故障诊断系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <style>
        /* 添加页脚固定样式 */
        body {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        .content-wrapper {
            flex: 1 0 auto;
        }
        .footer {
            flex-shrink: 0;
        }
        /* 添加闪电图标样式 */
        .signature-icon {
            color: #0d6efd;
            margin-left: 0.5rem;
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.2); }
            100% { transform: scale(1); }
        }
    </style>
</head>
<body class="d-flex flex-column h-100">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('main.index') }}">故障诊断系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.index') }}">主页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('training.index') }}">模型训练</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="{{ url_for('inference.index') }}">模型推理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('data.index') }}">数据管理</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="content-wrapper">
        <div class="container mt-4">
            <div class="row">
                <!-- 输入数据卡片 -->
                <div class="col-md-6 mb-4">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title mb-0">输入数据</h5>
                        </div>
                        <div class="card-body">
                            <form id="inference-form" class="inference-form">
                                <div class="form-group">
                                    <label for="input-data">输入数据 (JSON格式):</label>
                                    <textarea id="input-data" name="input-data" rows="4" class="form-control" required
                                        placeholder='[1.0, 2.0, 3.0, 4.0]'></textarea>
                                    <div class="form-text">请注意：1. 值必须是数组格式 2. 数组内的数字可以是整数或小数</div>
                                </div>
                                <button type="submit" class="btn btn-primary mt-3">开始诊断</button>
                            </form>
                        </div>
                    </div>

                    <!-- 数据格式说明 -->
                    <div class="card mt-3">
                        <div class="card-header">
                            <h5 class="card-title mb-0">数据格式说明</h5>
                        </div>
                        <div class="card-body">
                            <ul>
                                <li>数组长度必须与训练数据特征数量（10）相同</li>
                                <li>所有值必须是数值类型</li>
                                <li>示例: [1.0, 2.0, 3.0, 4.0]</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- 诊断结果卡片 -->
                <div class="col-md-6 mb-4">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title mb-0">诊断结果</h5>
                        </div>
                        <div class="card-body">
                            <div id="result" class="result-container">
                                <!-- 结果将在这里显示 -->
                            </div>
                        </div>
                    </div>

                    <!-- 置信度分布图 -->
                    <div class="card mt-3">
                        <div class="card-header">
                            <h5 class="card-title mb-0">置信度分布</h5>
                        </div>
                        <div class="card-body">
                            <div id="confidence-plot"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer class="footer py-3 bg-light mt-auto">
        <div class="container">
            <div class="row">
                <div class="col-md-6 text-center text-md-start">
                    <span class="text-muted">故障诊断系统 &copy; 2024</span>
                </div>
                <div class="col-md-6 text-center text-md-end">
                    <span class="text-muted">Powered by BROZHANG <i class="bi bi-lightning-charge-fill signature-icon"></i></span>
                </div>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
    <script src="{{ url_for('static', filename='js/inference.js') }}"></script>
</body>
</html> 